package br.com.Bolao.application.dao;

import org.hibernate.Session;
import org.jboss.seam.annotations.In;

/**
 *
 * @author frederico.cruz
 */
public class BaseDAO {

    @In
    private Session bolao;

    public void salvar(Object obj) {
        try {
            bolao.save(obj);
            bolao.flush();
        }catch(Exception e){
            e.printStackTrace();
        }
    }

    public void excluir(Object obj) {
        bolao.delete(obj);
        bolao.flush();
    }

    public void atualizar(Object obj) {
        bolao.saveOrUpdate(obj);
        bolao.flush();
    }
    //TODO SELECT
    /*public Object obterPorId(Class classe, Object obj){
    Criteria c = bolao.createCriteria(classe);
    c.add(Restrictions.eq("", obj))
    }*/
}
